import { useState } from "react"
function  useGetInfo(){
	const [info,setInfo]=useState({})
	//模拟下获取个人信息的接口
	new Promise((resolve,reject)=>{
		resolve({
			name:'wgy',
			area:'余杭'
		})
	}).then(res=>{
		setInfo(res)
	})
	return [info,setInfo]
}
 
export function Test16() {
    const [info,setInfo]=useGetInfo()
    return (
        <div>
            <h1>16.自定义Hook</h1> 
            <div>姓名:{info.name}</div> 
            <div>地区:{info.area}</div>
        </div>
    )
}